﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimpleReciever
{
    class VectorMath
    {
        public static Vector VectorTo3DAngle(Vector vec, bool degrees)
        {
            Vector output = new Vector();
            output.X = (Math.Atan2(vec.Y, vec.X));
            output.Y = (Math.Atan2(vec.Y, vec.Z));
            output.Z = (Math.Atan2(vec.X, vec.Z));
            if (degrees)
            {
                output.X = rtd(output.X);
                output.Y = rtd(output.Y);
                output.Z = rtd(output.Z);
            }
            return output;
        }
        public static double rtd(double angle)
        {
            double ret = angle * (180.0 / Math.PI);
            if(ret<0)
                ret+=360;
            if(ret>=360)
                ret-=360;
            return ret;
        }
    }
    class Vector
    {
        public double X, Y, Z;
        public Vector() { }
        public Vector(double x, double y, double z)
        {
            X = x;
            Y = y;
            Z = z;
        }
    }
}
